import Network from './network/index.js'

/**
 * 小程序等快应用
 */
class XappNetwork extends Network {
  constructor({
    fetch,
  }) {
    super()
    this.fetch = fetch // 依赖注入
  }

  getRealUrl(option) {
    const {
      BASE_URL,
    } = this.config
    const { url, prefix } = option
    return /^(http|https):\/\//.test(url) ? url : `${BASE_URL}${prefix}${url}`
  }

  async created() {
    this.networkList = [] // 请求列表容器
  }
}

export default XappNetwork
